import { get_stock_location } from '/@/api/work/stockroom/stockroom';

export function getTableStockroom(
  updateTableColData,
  setCacheColumnsByField,
  getFieldsValue,
  stockroomKey = 'Stockroom',
): void {
  updateTableColData('StockroomLocation', '');
  setCacheColumnsByField?.('StockroomLocation', {
    editComponent: 'ApiSelect',
    editComponentProps: {
      api: get_stock_location,
      resultField: 'Items',
      fieldNames: {
        children: 'Children',
        label: 'StockroomLocation',
        value: 'StockroomLocation',
      },
      params: {
        Stockroom: getFieldsValue[stockroomKey],
      },
      immediate: true,
      getPopupContainer: () => document.body,
    },
  });
}
